package com.atguigu.gmall.product.service.impl;

import com.atguigu.gmall.common.constant.RedisConst;
import com.atguigu.gmall.product.mapper.BaseCategory1Mapper;
import com.atguigu.gmall.product.pojo.BaseCategory1;
import com.atguigu.gmall.product.service.BaseCategory1Service;
import com.atguigu.gmall.product.vo.CategoryTreeVo;
import com.atguigu.gmall.starter.cache.aspect.annotation.MallCache;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author h8467
* @description 针对表【base_category1(一级分类表)】的数据库操作Service实现
* @createDate 2022-11-29 16:02:29
*/
@Service
public class BaseCategory1ServiceImpl extends ServiceImpl<BaseCategory1Mapper, BaseCategory1>
    implements BaseCategory1Service{

    @Override
    public List<BaseCategory1> getAll() {
        return baseMapper.selectList(null);
    }

    @Override
    @MallCache(cacheKey = RedisConst.CATEGORY_CACHE)
    public List<CategoryTreeVo> getCategoryTree() {
        List<CategoryTreeVo> list = baseMapper.getCategoryTree();
        return list;
    }

    @Override
    public CategoryTreeVo getCateGoryTreeWithC3id(Long c3id) {
        CategoryTreeVo categoryTreeVo= baseMapper.getCateGoryTreeWithC3id(c3id);
        return categoryTreeVo;
    }
}




